
<template>
  <div class="op-btn">
    <el-button  type="text" size="small" v-if="params.status !=1"   @click="handlerClick(0)">启用</el-button>
    <el-button  type="text" size="small" v-if="params.status == 1"   @click="handlerClick(1)">停用</el-button>
  </div>
</template>

<script>
export default {
  name: "apiMethodsStatusChange",
  props:{
    params:{
      default:()=>{}
    }
  },
  methods:{
    handlerClick(index){
      this.$confirm('确定修改状态？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        let api = index == 0?'publishMethod':'closeMethod'
        this.$api[api]({id:this.params.id}).then(res=>{
          this.$message.success('操作成功')
          this.$emit('after-op')
        })
      }).catch(() => {

      });
    },
  },

}
</script>

<style scoped>

</style>